package com.book.controller;

import com.book.format.Result;
import com.book.service.LoginService;
import com.book.service.UserService;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.Map;

/**
 * Created by Mikey on 2017/6/10.
 */
@Controller
public class LoginController {

    private Logger log = Logger.getLogger(UserController.class);

    @Resource
    private LoginService loginService;

    @RequestMapping("/")
    public String login(){
        return "login";
    }

    @RequestMapping("/doLogin.json")
    @ResponseBody
    public Result doLogin(String username, String password , HttpSession session){
        log.info("账号:"+username);
        log.info("密码："+password);
        return loginService.doLogin(username,password,session);
    }
}
